﻿using System;
using System.Xml;
using System.IO;
using System.Xml.Serialization;
using System.Text;


public static class XmlSerialization
{
    public static XmlDocument RootToXml(Request_License_compliance_with_fire_safety_requirements result)
    {
        System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(Request_License_compliance_with_fire_safety_requirements));        
        MemoryStream stream = new MemoryStream();
        XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
        ns.Add(String.Empty, "Request_License_compliance_with_fire_safety_requirements");
        xs.Serialize(stream, result, ns);
        StreamReader reader1 = new StreamReader(stream);
        byte[] bytes = new byte[stream.Length];
        stream.Position = 0;
        stream.Read(bytes, 0, (int)stream.Length);
        string data = Encoding.UTF8.GetString(bytes);
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(data);
        return doc;
    }
    public static XmlDocument RootToXml(Response_License_compliance_with_fire_safety_requirements result)
    {
        System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(Response_License_compliance_with_fire_safety_requirements));
        MemoryStream stream = new MemoryStream();
        XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
        ns.Add(String.Empty, "Response_License_compliance_with_fire_safety_requirements");
        xs.Serialize(stream, result);
        StreamReader reader1 = new StreamReader(stream);
        byte[] bytes = new byte[stream.Length];
        stream.Position = 0;
        stream.Read(bytes, 0, (int)stream.Length);
        string data = Encoding.UTF8.GetString(bytes);
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(data);
        return doc;
    }
}
